<template>
  <div class="outer">
    <div class="header">
      <!--头部第二行 搜索区域-->
      <div class="bottom">
        <h1 class="logoArea">
          <!-- <a href="#">S H O E S</a> -->
          <router-link to="/Home"> S H O E S </router-link>
        </h1>
        <div class="searchArea">
          <form action="###" class="searchForm">
            <input
              type="text"
              id="autocomplete"
              class="input-error input-xxlarge"
              v-model="keyWord"
            />
            <button
              class="sui-btn btn-xlarge btn-danger"
              type="button"
              @click="goSearch"
            >
              搜索
            </button>
          </form>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "MySearch",
  data() {
    return {
      keyWord: "",
    };
  },
  methods: {
    goSearch() {
      // 判断关键词是否空
      if (this.keyWord.trim() != "") {
        // 整理点击后跳转的页面和参数
        let location = {
          name: "search",
          query: { keyWord: this.keyWord || undefined },
        };
        // location.query = this.$route.query;
        this.$router.push(location);
      }
    },
  },
};
</script>

<style lang="less" scoped>
.outer {
  .header {
    & > .bottom {
      width: 1200px;
      margin: 0 auto;
      overflow: hidden;

      .logoArea {
        margin: 25px 30px;

        float: left;
        a {
          font-family: Arial, Helvetica, sans-serif;
          color: rgb(3, 138, 143);
          margin: 25px 45px;
          font-size: 24px;
        }
        .logo {
          img {
            width: 175px;
            margin: 25px 45px;
          }
        }
      }

      .searchArea {
        float: right;
        margin-top: 35px;

        .searchForm {
          overflow: hidden;

          input {
            box-sizing: border-box;
            width: 490px;
            height: 32px;
            padding: 0px 4px;
            border: 2px solid rgb(3, 138, 143);
            float: left;

            &:focus {
              outline: none;
            }
          }

          button {
            height: 32px;
            width: 68px;
            background-color: rgb(3, 138, 143);
            border: none;
            color: #fff;
            float: left;
            cursor: pointer;

            &:focus {
              outline: none;
            }
          }
        }
      }
    }
  }
}
</style>